package com.zealfi.wk.service.controller;

import com.zealfi.wk.api.pojo.User;
import com.zealfi.wk.api.service.HelloService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by kuan at 2018-04-24 上午 9:49
 * <br/>使用Spring Cloud Feign完成接口调用
 */
@RestController
public class RefactorHelloController implements HelloService {
    private static final Logger log = LoggerFactory.getLogger(RefactorHelloController.class);

    @Override
    public String hello() {
        return "hello";
    }

    @Override
    public String hello(String name) {
        return "hello " + name;
    }

    @Override
    public User hello(@RequestHeader("name") String name, @RequestHeader("age") Integer age) {
        return new User(name, age);
    }

    @Override
    public String hello(@RequestBody User user) {
        return "hello " + user.getName() + ", " + user.getAge();
    }

    @Override
    public String hello5(Long userId) {
        return "userId:" + userId;
    }
}
